<%@ page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>

<html>
<head>

<style>
  #progressbar .ui-progressbar-value {
    background-color: #ccc;
  }
</style>

<!-- <script type="text/javascript" src="js/CheckCardIDUtil.js"> -->
<script type="text/javascript">
var listPageUrl="salary/index.do";

var listUrl="rest/userList.do";
var sexJson; 
var userStatusJson;
var city;


$(document).ready(function () {  
	
	
	
})//end ready

function uploadSalary() {
	//$('#user-fm').birthday 编辑日期表单值，然后提交
	
	var fd = new FormData();
 	fd.append("uploadfile", $("#uploadfile").get(0).files[0]);
 
 	$.ajax({
 		  url: 'rest/salaryUploadFile.do',
 		  type: 'POST',
 		  data: fd,
 		  cache: false,
 		  processData: false,
 		  contentType: false,
 		  beforeSend:function(XMLHttpRequest){ 
 			 /* var message="上传中";
 			 $.messager.alert('上传中', message, message); */
 			 
 			 var progressbar=$("#progressbar" ).progressbar({value: Math.floor(  Math.random()*100)});
 			 /* var progressbarValue = progressbar.find( ".ui-progressbar-value" );
 			 progressbarValue.css({
 		          "background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 )
 		        }); */
 		        
 			progressbar.progressbar( "option", "value", false ); 			    
          }, 
 		  success: (function(response) { 
 			       if (response.retCode == "0000") {
						var message="总计记录为："+response.data.total+"<br>"+
						"成功记录为："+response.data.success+"<br>"+
						"空记录为："+response.data.nullmsg+"<br>"+
						"失败记录为："+response.data.fail+"<br>"+
						"重复记录为："+response.data.rep;
	 			 		$.messager.alert('上传结果', message, message);
					} else {
	 			 		$.messager.alert('上传结果','导入失败，服务异常', '导入失败，服务异常');
					}
 			 		back(listPageUrl)
 				   })
 		  
 	});
   
}

function back(url){
	$.get(url, {}, function(data){
		$("#center").empty();
        $("#center").html(data);
        $.parser.parse($("#center"));
    });
}

$('#sex').combobox({
	onLoadSuccess :function(){
	$('#sex').combobox('select','0');
	}
});
</script>
</head>
<body>
		
<div class="linkbar"><a>业务</a>/<a>工资管理</a>/<a> 导入</a></div>
<!-- 		<div class="breadcrumb">系统 &gt;&gt; 用户管理 &gt;&gt; 新增用户</div> -->
		<div id="user-add" 	buttons="#user-add-buttons">
			<form id="user-fm" method="post" novalidate>
			<div class="fitem">
				<input name="uploadfile"  type="file" id="uploadfile" required="true" />
			</div>
			<div id="progressbar"></div>
			

			

								
			</form>
		</div>
		<div id="dlg-buttons">
			<a href="#" class="easyui-linkbutton" iconCls="icon-ok" 	onclick="uploadSalary()">导入</a> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="back('salary/index.do')">返回</a>
		</div>
		

</body>
</html>